/*
 * chatRoom.h
 *
 *  Created on: 2010-3-20
 *      Author: abc
 */

#ifndef CHATROOM_H_
#define CHATROOM_H_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <errno.h>
#include <netinet/in.h>
#include <pthread.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <glib.h>
#define NAMESIZE 64
#define MAXLEN 128
typedef struct _chatRoom
{
    int id;
    int exit;
	struct sockaddr_in addr_in;
	char roomName[NAMESIZE];
	char hostName[NAMESIZE];
	int memberNum;
	char description[MAXLEN];
    int isNeedPasswd;
    int count;
	struct _chatRoom* next;
}chatRoom,*pchatRoom;

 pchatRoom crCreateLinkList(void);
 void crdeletelist(pchatRoom L ,int id);
 void crinsertend(pchatRoom L,pchatRoom M);
 int crisexisted(pchatRoom L, int id);
 pchatRoom getByID(pchatRoom L, int id);
 void crDisplayList(pchatRoom L);



 typedef struct _clientinfoFC{
     char name[64];
     struct sockaddr_in addr_in;
     struct _clientinfoFC* next;
 }clientinfoFC,* pclientinfoFC;
 struct message
 {
 	char flag[15];
 	char name[10];
 	int size;
 	char msg[MAXLEN];
 };

 pclientinfoFC pcCreateLinkList(void);
  void pcdeletelist(pclientinfoFC L ,char* name);
  void pcinsertend(pclientinfoFC L,pclientinfoFC M);
  int pcisexisted(pclientinfoFC L, char* name);
  void pcDisplayList(pclientinfoFC L);


  typedef struct _clientinfoFS{
      char name[64];
      struct sockaddr_in addr_in;
      int sockfd;
      pthread_t pid;
      struct _clientinfoFS* next;
  }clientinfoFS,* pclientinfoFS;



  pclientinfoFS CreateLinkList(void);
  void deletelist(pclientinfoFS L ,char* name);
  void insertend(pclientinfoFS L,pclientinfoFS M);
  int isexisted(pclientinfoFS L, char* name);
  void DisplayList(pclientinfoFS L);

#endif /* CHATROOM_H_ */
